package com.dragon.web.ykd.controller;

import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dragon.app.ykd.service.EquipmentAgainstFraudService;
import com.fintech.common.constant.ErrorCode;
import com.fintech.common.vo.FintechResult;
import com.marvels.common.utils.MarvelsLogUtil;

import net.sf.json.JSONObject;

/**
 * 设备反欺诈
 * 
 * @author tangpw
 *
 */
@Controller
@RequestMapping("${platform.name.code}")
public class EquipmentAgainstFraudController {
	@Autowired
	private EquipmentAgainstFraudService equipmentAgainstFraudService;

	/**
	 * 提现设备反欺诈
	 * @param map
	 * loanId：进件流水号
	 * mobile：电话号码
	 * afSwiftNumber：前端集成百融sdk生成的唯一标示
	 * interfaceName：接口类型名称ykd，bdd
	 * @return
	 */
	@RequestMapping("/equipment/cashFacilityInformation")
	@ResponseBody
	public FintechResult cashFacilityInformation(@RequestBody Map<String, Object> map) {
		if(null==map){
			return FintechResult.getFailResult(ErrorCode.FAIL, "参数不能为空");
		}
		return equipmentAgainstFraudService.cashFacilityInformation(map);
				
	}

	/**
	 * 借款设备反欺诈
	 * @param map
	 * loanId：进件流水号
	 * mobile：电话号码
	 * afSwiftNumber：前端集成百融sdk生成的唯一标示
	 * interfaceName：接口类型名称ykd，bdd
	 * @return
	 */
	@RequestMapping("/equipment/loanFacilityInformationReport")
	@ResponseBody
	public FintechResult loanFacilityInformationReport(@RequestBody Map<String, Object> map) {
		MarvelsLogUtil.getInstance().info("==========借款设备反欺诈查询请求参数:" + JSONObject.fromObject(map));
		if(null==map){
			return FintechResult.getFailResult(ErrorCode.FAIL, "参数不能为空");
		}
		return equipmentAgainstFraudService.loanFacilityInformationReport(map);
	}
	
	/**
	 * 登录设备反欺诈
	 * @param map
	 * mobile：电话号码
	 * afSwiftNumber：前端集成百融sdk生成的唯一标示
	 * interfaceName：接口类型名称ykd，bdd 
	 * @return
	 */
	@RequestMapping("/equipment/loginFacilityInformationReport")
	@ResponseBody
	public FintechResult loginFacilityInformationReport(@RequestBody Map<String, Object> map) {
		if(null==map){
			return FintechResult.getFailResult(ErrorCode.FAIL, "参数不能为空");
		}
		return equipmentAgainstFraudService.loginFacilityInformationReport(map);
	}

	/**
	 * 注册设备反欺诈
	 * @param map
	 * mobile：电话号码
	 * afSwiftNumber：前端集成百融sdk生成的唯一标示
	 * interfaceName：接口类型名称ykd，bdd
	 * @return
	 */
	@RequestMapping("/equipment/registerFacilityInformationReport")
	@ResponseBody
	public FintechResult registerFacilityInformationReport(@RequestBody Map<String, Object> map) {
		if(null==map){
			return FintechResult.getFailResult(ErrorCode.FAIL, "参数不能为空");
		}
		return equipmentAgainstFraudService.registerFacilityInformationReport(map);
	}

}
